package com.example.api.module.user.vo;

import com.example.api.validator.group.Insert;
import com.example.api.validator.group.Update;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Pattern;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;

import java.io.Serializable;

@Data
@EqualsAndHashCode()
@ToString
@ApiModel("用户实体")
public class UserVO implements Serializable {
    @NotNull(groups = {Update.class}, message = "主键不能为空")
    private Long id;

    @ApiModelProperty(value = "昵称")
    private String name;

    @ApiModelProperty(value = "密码")
    private String password;

    @Pattern(groups = {Insert.class, Update.class}, regexp = "^[a-zA-Z0-9_.-]+@[a-zA-Z0-9-]+(\\.[a-zA-Z0-9-]+)*\\.[a-zA-Z0-9]{2,6}$",message = "邮箱格式不正确")
    @ApiModelProperty(value = "账号(邮箱为账号)")
    private String email;

    @NotBlank(groups = {Insert.class}, message = "手机号不能为空")
    @Pattern(groups = {Insert.class, Update.class}, regexp = "^1\\d{10}$",message = "手机号格式不正确")
    @ApiModelProperty(value = "手机号")
    private String mobile;

    @ApiModelProperty(value = "年龄")
    private int age;

    @ApiModelProperty(value = "性别(0：男  1：女)")
    private int sex;

    @ApiModelProperty(value = "账号状态(0：正常  1：禁用)")
    private int status;
}
